package org.juiceshop.gm.midi;




public class TrackBuilderX {


	private MidiSequence _track;
	private int _channel;
	private long _timer;

	public TrackBuilderX(MidiSequence track, int channel) {
		this._track = track;
		this._channel = channel;
	}

	public long getTimer() {
		return _timer;
	}

	public void setTimer(long timer) {
		_timer = timer;
	}
	
	public void advance (long time) {
		_timer += time;
	}


	public void noteOn(int pitch, int velocity) {
		_track.addNoteOnEvent(_timer, _channel, pitch, velocity);
	}

	public void noteOff(int pitch, int decay) {
		_track.addNoteOffEvent(_timer, _channel, pitch, decay);
	}

	public void programChange(int instrument) {
		_track.addProgramChangeEvent(_timer, _channel, instrument);
	}
	
	public void programChange(Instrument instr) {
		_track.addProgramChangeEvent(_timer,_channel,instr.ordinal());
	}
	
	public void pitchBend (int bend) {
		_track.addPitchBendEvent(_timer, _channel, bend);
	}
	
	public void pitchBend () {
		pitchBend(0);
	}


}
